#coding=utf-8

# 选课
from tortoise.models import Model
from tortoise import fields

# 班级类
class Classes(Model):
    no = fields.IntField(pk=True)
    name = fields.CharField(max_length=32, description="班级名")


# 讲师类
class Teachers(Model):
    no =fields.IntField(pk=True)
    name = fields.CharField(max_length=32, description="账号")
    password = fields.CharField(max_length=64, description="密码")


# 课程类
class Courses(Model):
    id = fields.IntField(pk=True)
    subject = fields.CharField(max_length=32)
    subject_name = fields.CharField(max_length=32, description="学科名")
    addr = fields.CharField(max_length=50, description="教室地址")
    t_no = fields.ForeignKeyField("models.Teachers", related_name="Teachers")


# 学生类
class Students(Model):
    no =fields.IntField(pk=True)
    name = fields.CharField(max_length=32, description="账号")
    password = fields.CharField(max_length=64, description="密码")
    c_no = fields.ForeignKeyField("models.Classes", related_name="Classes")
    c_subject = fields.ManyToManyField("models.Courses", related_name="Courses")
    

    

